package br.com.gr.jcash.dao;

import br.com.gr.jcash.dmp.Grupo;
import br.com.gr.jcash.dmp.Usuario;
import br.com.gr.jcash.exception.JCashException;
import br.com.gr.jcash.constantes.GrupoEnum;
import java.util.List;
import javax.annotation.security.PermitAll;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

@Stateless
public class GrupoDAO extends AbstractDAO<Grupo, Long> {

    @PersistenceContext(unitName = "jcash-PU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public GrupoDAO() {
        super(Grupo.class);
    }

    @Override
    public List<Grupo> buscarTodos(Usuario usuario) throws JCashException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public List<Grupo> buscarPorFaixa(Usuario usuario, int[] faixa) throws JCashException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public Long count(Usuario usuario) throws JCashException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @PermitAll
    public Grupo buscarPorNomeGrupo(GrupoEnum nomeGrupo) throws JCashException {
        return buscarUnico("Grupo.buscarPorGrpNome", nomeGrupo.name());
    }
    
}
